<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    
    <meta property="og:site_name" content="LXF Site">
    <meta property="og:type" content="article">

    
    <meta property="og:image" content="/blog//">
    <meta property="twitter:image" content="/blog//" />
    

    
    <meta name="title" content="Neo4j Firststep" />
    <meta property="og:title" content="Neo4j Firststep" />
    <meta property="twitter:title" content="Neo4j Firststep" />
    

    
    <meta name="description" content="">
    <meta property="og:description" content="" />
    <meta property="twitter:description" content="" />
    

    
    <meta property="twitter:card" content="summary" />
    
    

    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/blog/img/favicon.ico">

    <title>Neo4j Firststep-</title>

    <link rel="canonical" href="/blog/post/neo4j-firststep/">

    <link rel="stylesheet" href="/blog/css/iDisqus.min.css"/>

    
    <link rel="stylesheet" href="/blog/css/bootstrap.min.css">

    
    <link rel="stylesheet" href="/blog/css/hugo-theme-cleanwhite.min.css">

    
    <link rel="stylesheet" href="/blog/css/zanshang.css">

    
    <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" rel="stylesheet" type="text/css">

    
    

    
    
    <script src="/blog/js/jquery.min.js"></script>

    
    <script src="/blog/js/bootstrap.min.js"></script>

    
    <script src="/blog/js/hux-blog.min.js"></script>

    
    

</head>




<nav class="navbar navbar-default navbar-custom navbar-fixed-top">

    <div class="container-fluid">
        
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/blog/">LXF Site</a>
        </div>

        
        
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/blog/">Home</a>
                    </li>
                    
                        
                        <li>
                            <a href="/blog/categories/%E8%BD%AF%E4%BB%B6%E4%BD%BF%E7%94%A8">软件使用</a>
                        </li>
                        
                    
                    
		    

                    
                </ul>
            </div>
        </div>
        
    </div>
    
</nav>
<script>
    
    
    
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        
            $navbar.className = " ";
            
            setTimeout(function(){
                
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>




<style type="text/css">
    header.intro-header {
        background-image: url('/blog/')
    }
</style>

<header class="intro-header" >

    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <div class="tags">
                        
                        <a class="tag" href="/blog/tags/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1" title="知识图谱">
                            知识图谱
                        </a>
                        
                    </div>
                    <h1>Neo4j Firststep</h1>
                    <h2 class="subheading"></h2>
                    <span class="meta">
                        
                            Posted by 
                            
                                    LXF Site
                             
                            on 
                            Thursday, November 18, 2021
                            
                            
                            
                            
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>




<article>
    <div class="container">
        <div class="row">

            
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                
                <h1 id="安装neo4j-desktop">安装neo4j Desktop</h1>
<p>从neo4j官网（https://neo4j.com/）下载neo4j Desktop.
安装。</p>
<h1 id="创建项目">创建项目</h1>
<p>1、创建新项目。</p>
<p>
  <img src="/blog/img/image-20211111153922530.png" alt="">

</p>
<p>2、选择当前项目后，在项目内创建DBMS，不创建也没有问题，就用缺省的“Graph DBMS”。</p>
<p>
  <img src="/blog/img/image-20211111154119995.png" alt="">

</p>
<p>3、在DBMS中创建数据库，我们这里创建test。</p>
<p>首先启动DBMS:</p>
<p>
  <img src="/blog/img/image-20211112081251574.png" alt="">

</p>
<p>创建数据库：</p>
<p>
  <img src="/blog/img/image-20211112080908838.png" alt="">

</p>
<p>创建后可以看到创建的数据库。</p>
<p>
  <img src="/blog/img/image-20211112080936424.png" alt="">

</p>
<p>这是可以看到test数据库里是空的：</p>
<p>
  <img src="/blog/img/image-20211112081411530.png" alt="">

</p>
<p>4、点击运行Graph Apps图标</p>
<p>
  <img src="/blog/img/image-20211112101448631.png" alt="">

</p>
<p>5、运行Neo4j Browser</p>
<p>
  <img src="/blog/img/image-20211112101558506.png" alt="">

</p>
<p>6、Neo4j Browser起来后，点击Database图标，选择test数据库。</p>
<p>
  <img src="/blog/img/image-20211112101841479.png" alt="">

</p>
<p>7、在此数据库上执行Cypher语句（简单介绍参考 <a href="https://neo4j.com/docs/cypher-manual/current/introduction/">https://neo4j.com/docs/cypher-manual/current/introduction/</a> ）进行图谱的操作。</p>
<p>Cypher语句执行的位置：</p>
<p>
  <img src="/blog/img/image-20211112102128812.png" alt="">

</p>
<p>执行语句点击语句行右边的三角。</p>
<p>8、创建一个图谱</p>
<p>CREATE (john:Person {name: &lsquo;John&rsquo;})
CREATE (joe:Person {name: &lsquo;Joe&rsquo;})
CREATE (steve:Person {name: &lsquo;Steve&rsquo;})
CREATE (sara:Person {name: &lsquo;Sara&rsquo;})
CREATE (maria:Person {name: &lsquo;Maria&rsquo;})
CREATE (john)-[:FRIEND]-&gt;(joe)-[:FRIEND]-&gt;(steve)
CREATE (john)-[:FRIEND]-&gt;(sara)-[:FRIEND]-&gt;(maria)</p>
<p>屏幕显示：Added 5 labels, created 5 nodes, set 5 properties, created 4 relationships, completed after 326 ms.</p>
<p>此图谱图示为：</p>
<p>
  <img src="/blog/img/image-20211112102445372.png" alt="">

</p>
<p>9、再举一个查询示例：查找一个叫John的人，和John的朋友的朋友</p>
<p>查询语句：</p>
<p>MATCH (john {name: &lsquo;John&rsquo;})-[:FRIEND]-&gt;()-[:FRIEND]-&gt;(fof)
RETURN john.name, fof.name</p>
<p>执行情况：</p>
<p>
  <img src="/blog/img/image-20211112102823756.png" alt="">

</p>
<h1 id="安装新的graph-apps">安装新的Graph Apps</h1>
<p>1、在这里找你想要的App，<a href="https://install.graphapp.io/">Neo4j Desktop Graph Apps Gallery</a>（https://install.graphapp.io/）</p>
<p>2、点击App 链接地址，如下：</p>
<p>
  <img src="/blog/img/image-20211111144532918.png" alt="">

</p>
<p>出现如下内容：</p>
<p>
  <img src="/blog/img/image-20211111145022427.png" alt="">

</p>
<p>3、将此链接地址“https://neo.jfrog.io/neo/api/npm/npm/graph-gallery”拷贝到Desktop App 安装路径处，点击Install按键，进行安装（安装过程比较慢，耐心等待）</p>
<p>4、出现不能验证签名的提示，点击Yes-Install，完成安装</p>
<p>
  <img src="/blog/img/image-20211111144845962.png" alt="">

</p>
<p>5、安装后出现新的App</p>
<p>
  <img src="/blog/img/image-20211111152145699.png" alt="">

</p>


                

                <hr>
                <ul class="pager">
                    
                    
                    <li class="next">
                        <a href="/blog/post/hugo%E4%BD%BF%E7%94%A8%E8%BF%87%E7%A8%8B/" data-toggle="tooltip" data-placement="top" title="Hugo极简使用过程">Next
                            Post &rarr;</a>
                    </li>
                    
                </ul>
                
<div id="disqus-comment"></div>


            </div>

            
            
            <div class="
                col-lg-2 col-lg-offset-0
                visible-lg-block
                sidebar-container
                catalog-container">
                <div class="side-catalog">
                    <hr class="hidden-sm hidden-xs">
                    <h5>
                        <a class="catalog-toggle" href="#">CATALOG</a>
                    </h5>
                    <ul class="catalog-body"></ul>
                </div>
            </div>
            

            
            <div class="
                col-lg-11 col-lg-offset-1
                col-md-10 col-md-offset-1
                sidebar-container">

                
                

                
                
            </div>
        </div>
    </div>
</article>




<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                   
                    

                    
                    
                    

                    

		    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
            
            
            
                </ul>
		<p class="copyright text-muted">
                    Copyright &copy; LXF Site 2021
                    <br>
                    <a href="https://themes.gohugo.io/hugo-theme-cleanwhite">CleanWhite Hugo Theme</a> by <a href="https://zhaohuabing.com">Huabing</a> |
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="100px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=zhaohuabing&repo=hugo-theme-cleanwhite&type=star&count=true" >
                    </iframe>
                </p>
            </div>
        </div>
    </div>
</footer>




<script>
    function loadAsync(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>






<script>
    
    if($('#tag_cloud').length !== 0){
        loadAsync("/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>


<script>
    loadAsync("https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>









<script type="text/javascript">
    function generateCatalog(selector) {

        
        
        
        
            _containerSelector = 'div.post-container'
        

        
        var P = $(_containerSelector), a, n, t, l, i, c;
        a = P.find('h1,h2,h3,h4,h5,h6');

        
        $(selector).html('')

        
        a.each(function () {
            n = $(this).prop('tagName').toLowerCase();
            i = "#" + $(this).prop('id');
            t = $(this).text();
            c = $('<a href="' + i + '" rel="nofollow">' + t + '</a>');
            l = $('<li class="' + n + '_nav"></li>').append(c);
            $(selector).append(l);
        });
        return true;
    }

    generateCatalog(".catalog-body");

    
    $(".catalog-toggle").click((function (e) {
        e.preventDefault();
        $('.side-catalog').toggleClass("fold")
    }))

    


    loadAsync("\/blog\/js\/jquery.nav.js", function () {
        $('.catalog-body').onePageNav({
            currentClass: "active",
            changeHash: !1,
            easing: "swing",
            filter: "",
            scrollSpeed: 700,
            scrollOffset: 0,
            scrollThreshold: .2,
            begin: null,
            end: null,
            scrollChange: null,
            padding: 80
        });
    });
</script>


</body>
</html>
